<template name="goodXuzhi">
	<view class="xuzhiBox">
		<text class="gmTitle">购买须知</text>
		<view class="xzTitle" v-if="fuwu.length>0">商家服务</view>
		<view class="fuwuBox">
			<text v-for="(item,index) in fuwu" :key="item">{{item}}</text>
		</view>
		<view class="xzTitle" v-if="tishi.length>0" >温馨提示</view>
		<text v-for="(item,index) in tishi" :key="item" >{{item}}</text>
		<view class="xzTitle">消费流程</view>
		<text v-for="(item,index) in liucheng" :key="item">{{item}}</text>
		<view class="xzTitle">消费须知</view>
		<text v-for="(item,index) in xuzhi" :key="item">{{item}}</text>
		 
	</view>
</template>

<script>
	import {mapState,mapGetters,mapMutation,mapActions} from "vuex";
	export default{	
		name:'goodXuzhi',		//组件名称
		// 传递参数
		props:{
			goodData:{
				type:Object,
				default:null
			}
		},
		// 组件参数
		data(){
			return {
				fuwu:[],
				tishi:[],
				liucheng:[],
				xuzhi:[]
			}
		},
		// 组件方法
		methods:{
			mtd1(){
				this.liucheng=this.goodData.consIncs.costflow.split("\n");
				this.xuzhi=this.goodData.consIncs.costkown.split("\n");
				if(this.goodData.consIncs.serviceChecked){
					this.goodData.consIncs.serviceChecked.split(",").filter((x)=>{
						if(x=='1'){
							this.fuwu.push('免费停车位')
						}else if(x=='2'){
							this.fuwu.push('免费wifi')
						}else if(x=='3'){
							this.fuwu.push('免费热饮')
						}
						return !!x;
					});	
				}
				
				let r=this.goodData.consIncs.costkown2.tailCut().split("\n");
				this.tishi=r.filter((x)=>{
					return !!x;
				})
			}
		},
		created() {
			setTimeout(()=>{
				this.mtd1()
			},1000)
		}
	}
</script>

<style lang="less" scoped>
	.xuzhiBox{
		padding-top: 20upx;
		display: flex;
		flex-direction: column;
		.gmTitle{
			font-size: 32upx;
			color: #000000;
			font-weight: bold;
			margin-bottom: 10upx;
		}
		.xzTitle{
			font-size: 32upx;
			// font-weight: bold;
			color: #666666;
			margin-bottom: 10upx;
		}
		text{
			font-size: 28upx;
			margin-bottom: 10upx;
			color: #202932;
		}
		.fuwuBox{
			display: flex;
			text{
				display: block;
				width: 33.33%;
			}
			
		}
	}
</style>
